package view;

/*
 * TCSS 360 - Winter 2014
 * TESK Software
 */
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D;
import java.io.File;
import java.util.ArrayList;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import SQL.DB;

import Content.ProjectModel;
import Content.SubProgramChair;
import view.Papers.AssignPapertoSubProgramChairView;
import view.Papers.EditPapers;
import view.Papers.ReviewerListView;
import view.Papers.SubmitPaperView;
import view.Papers.SubmitReviewView;
import view.personalInfo.ContactView;
import view.userProfile.AuthorView;
import view.userProfile.ProgramChairView;
import view.userProfile.ReviewerView;
import view.userProfile.SubProgramChairView;

/**
 * Provides a main frame for our running view.
 * 
 * @author Kon
 * @version March 20, 2014
 *
 */
@SuppressWarnings("serial")
public class MainFrame extends JFrame{
	
	/** The current panel displayed on the main frame.*/
	private JPanel my_currentPanel;
	
	/** The data base associated with the main frame. */
	public DB db;
	
	/** The current user of the program. */
	public String[][] currentUser;
	
	/**
	 * Constructs the main frame.
	 */
	public MainFrame(){
		super("Peer Review Management");
		db = new DB();
		currentUser = new String[2][2];
		
		my_currentPanel = new LogInView(this);


	}

	/**
	 * Set up the frame specifications.
	 * @author Kon.
	 */
	public void setUp(){
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setPreferredSize(new Dimension(500, 500));
		getContentPane().setLayout(new BorderLayout());
		//	my_currentPanel = new SubmitReviewView(this);
		JMenuBar menu = new MenuBar(this);
		menu.setBackground(Color.white);
		this.setJMenuBar(menu);
		getContentPane().add(my_currentPanel, BorderLayout.CENTER);//cant set background to color becaz the background belong to program chair gui.
		setLocation(300,200);
		setResizable(false);
		setVisible(true);
		pack();

	}
	/**
	 * Sets the current panel to the given panel.
	 * 
	 * @param new Panel the panel to set the current panel to
	 * @author Kon.
	 */
	public void setNewPanel(JPanel the_nextPanel) {
		this.remove(my_currentPanel);
		my_currentPanel = the_nextPanel;
		getContentPane().add(my_currentPanel);
		my_currentPanel.setBackground(new Color(255, 228, 225));
		pack();
		setVisible(true);

	}
	
	/**
	 * A method to choose a file to save.
	 * @return the file selected to save
	 */
	public File chooseFileSave() {
		JFileChooser fc = new JFileChooser();
		fc.showSaveDialog(fc);
		File file =fc.getSelectedFile();
		return file;
	}
	
	/**
	 * A method to choose a file to open.
	 * @return the file to open
	 */
	public File chooseFileOpen() {
		JFileChooser fc = new JFileChooser();
		fc.showOpenDialog(fc);
		File file =fc.getSelectedFile();
		return file;
	
	}

}
